<template>
    <div class="content">
        <div class="btn_all">
            <div :class="{ action: item.show }" class="btn" v-for="( item, index) in $store.state.btnList" :key="item.name" @click="handleBtn(item, index)">
                {{ item.newName }}
            </div>
        </div>

        <div>
            <keep-alive exclude="down,upload,set">
                <router-view/>
            </keep-alive>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            btnList: [
            ]
        }
    },
    methods: {
        handleBtn(item, index) {
            // console.log(':::,', item, index)
            // this.btnList.map((i, d) => {
            //     if(d === index ) {
            //         item.path && this.$router.push(
            //             {
            //                 path: item.path,
            //                 name: item.name
            //             })
            //         return ({ ...i.show = true })
            //     } else {
            //         return ({ ...i.show = false })
            //     }
            // })
            // this.$store.commit('handleSetPage', { item, index, router: this.$router })
        }
    }
}
</script>

<style lang="less" scoped>
.content {
    .btn_all {
        display: flex;
        // justify-content: center;
        align-items: center;
        width: 100%;
        height: 40px;
        box-sizing: border-box;
        background-color: #f7f7f7;
        border-radius: 6px;
        border: 1px solid #d9d9d9;
        padding-top: 5px;
        padding-left: 5px;

        .btn {
            border: 1px solid #86837b;
            height: 34px;
            line-height: 34px;
            padding: 0px 20px;
            border-radius: 4px;
            color: #c4afa0;
            cursor: pointer;
        }

        .action {
            color: #495057;
            border: 1px solid #9b9992;
        }
    }
}
</style>
